<!--点击列表中的一项，该项变为红色-->
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <style>
    .red {
      color: red;
    }
  </style>
</head>
<body>
<div id="app">
  <ul>
    <li v-for="(item, index) in movies" @click="chooseClick(index)" :class="{red: index === currentIndex}">{{item}}</li>
  </ul>
  <div style="background-color: red; width: 100px; height: 100px;"></div>
</div>
<script src="../js/vue.js"></script>
<script>

  const app = new Vue({
    el: '#app',
    data: {
      movies: ['海王', '海尔兄弟', '火影忍者', '进击的巨人'],
      currentIndex: 0
    },
    methods: {
      chooseClick(index) {
        this.currentIndex = index;
      }
    }
  })
</script>
</body>
</html>